﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Restaurant.DTO;
using Restaurant.DAO;
using System.Data;



namespace Restaurant.BUS
{
    public class HanThanhToanService
    {
        private HanThanhToanDB httDAO = new HanThanhToanDB();

        public DataTable LoadHanThanhToan()
        {
            return httDAO.LayHanThanhToan();
        }

        public string LayHanThanhToanTheoMa(int ma)
        {
            DataTable dbtab = httDAO.LayHanThanhToan(ma);
            DataRow dbrow = dbtab.Rows[0];
            return dbrow[1].ToString();
        }

        public DataTable LoadHinhThucThanhToan()
        {
            return httDAO.LayHinhThucThanhToan();
        }

        public string LayHinhThucThanhToanTheoMa(int ma)
        {
            DataTable dbtab = httDAO.LayHinhThucThanhToan(ma);
            DataRow dbrow = dbtab.Rows[0];
            return dbrow[1].ToString();
        }

        public bool ThemHanThanhToan(string htt)
        {
            if (htt == "")
            {
                return false;
            }
            if (httDAO.ThemHanThanhToan(htt))
                return true;
            return false;
        }

        public bool SuaHanThanhToan(int ma,string htt)
        {
            if (htt == "")
            {
                return false;
            }
            if (httDAO.SuaHanThanhToan(ma,htt))
                return true;
            return false;
        }

        public bool ThemHinhThucThanhToan(string httt)
        {
            if (httt == "")
            {
                return false;
            }
            if (httDAO.ThemHinhThucThanhToan(httt))
                return true;
            return false;
        }

        public bool SuaHinhThucThanhToan(int ma, string httt)
        {
            if (httt == "")
            {
                return false;
            }
            if (httDAO.SuaHinhThucThanhToan(ma,httt))
                return true;
            return false;
        }

        public bool XoaHanThanhToan(int ma)
        {
            if (httDAO.XoaHanThanhToan(ma))
                return true;
            return false;

        }

        public bool XoaHinhThucThanhToan(int ma)
        {
            if (httDAO.XoaHinhThucThanhToan(ma))
                return true;
            return false;
        }
    }
}
